package com.kaoyaya.delivery.data;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.kaoyaya.delivery.data.entity.Combo;
import com.kaoyaya.delivery.data.entity.CostRecord;
import com.kaoyaya.delivery.data.entity.DeliveryRecord;
import com.kaoyaya.delivery.data.entity.OrderItem;
import com.kaoyaya.delivery.data.entity.Product;
import com.kaoyaya.delivery.data.entity.Result;
import com.kaoyaya.delivery.data.entity.UserInfo;
import com.kaoyaya.util.JsonUtil;

public class DateTest {

	public static String getStr(String url) {
		String result = null;
		if (url == "login") {
			UserInfo $result = new UserInfo();
			$result.setUserId(11L);
			$result.setResultCode(1);
			$result.setResultMessage("登录成功！");
			result = JsonUtil.toJson($result);
		} else if (url == "getUserAccount") {
			result = "16.8";
		}else if (url == "getAreaList") {
			String[] areas = new String[] {"南昌","上海","北京","深圳","广州","天津","重庆"};
			result = JsonUtil.toJson(areas);
		} else if (url == "getProductList") {
			result = JsonUtil.toJson(getProducts());
		} else if (url == "getComboList") {
			List<Combo> combos = new ArrayList<Combo>();
			Combo combo1 = new Combo();
			combo1.setId(1L);
			combo1.setName("套餐1");
			combo1.setPrice(135);
			combo1.setProducts(getProducts());
			combos.add(combo1);
			combos.add(combo1);
			combos.add(combo1);
			combos.add(combo1);
			combos.add(combo1);
			combos.add(combo1);
			result = JsonUtil.toJson(combos);
		} else if (url == "getDeliveryRecordList") {
			List<DeliveryRecord> records = new ArrayList<DeliveryRecord>();
			DeliveryRecord record = new DeliveryRecord();
			record.setUsername("测试中文");
			record.setMobile("13657097527");
			record.setEmail("13657097527@163.com");
			record.setCardTime(new Date());
			record.setOrder(getOrder());
			records.add(record);
			records.add(record);
			records.add(record);
			result = JsonUtil.toJson(records);
		} else if (url == "getCostRecordList") {
			result = JsonUtil.toJson(getCostRecords());
		}
		return result;
	}
	
	public static List<Product> getProducts() {
		List<Product> products = new ArrayList<Product>();
		Product product1 = new Product();
		product1.setArea("南昌");
		product1.setCategoryName("公务员考试");
		product1.setName("南昌公务员考试试卷");
		product1.setId(1001L);
		product1.setPrice(20.00);
		product1.setSubjectName("综合基础");
		products.add(product1);

		Product product2 = new Product();
		product2.setArea("南昌");
		product2.setCategoryName("公务员考试");
		product2.setName("南昌公务员考试试卷");
		product2.setId(1002L);
		product2.setPrice(20.00);
		product2.setSubjectName("综合基础");
		products.add(product2);

		Product product3 = new Product();
		product3.setArea("南昌");
		product3.setCategoryName("公务员考试");
		product3.setName("南昌公务员考试试卷");
		product3.setId(1003L);
		product3.setPrice(20.00);
		product3.setSubjectName("综合基础");
		products.add(product3);

		Product product4 = new Product();
		product4.setArea("南昌");
		product4.setCategoryName("公务员考试");
		product4.setName("南昌公务员考试试卷");
		product4.setId(1004L);
		product4.setPrice(20.00);
		product4.setSubjectName("综合基础");
		products.add(product4);

		Product product5 = new Product();
		product5.setArea("南昌");
		product5.setCategoryName("公务员考试");
		product5.setName("南昌公务员考试试卷");
		product5.setId(1005L);
		product5.setPrice(20.00);
		product5.setSubjectName("综合基础");
		products.add(product5);

		Product product6 = new Product();
		product6.setArea("南昌");
		product6.setCategoryName("公务员考试");
		product6.setName("南昌公务员考试试卷");
		product6.setId(1006L);
		product6.setPrice(20.00);
		product6.setSubjectName("综合基础");
		products.add(product6);

		return products;
	}
	
	public static List<OrderItem> getOrder(){
		List<OrderItem> goodses = new ArrayList<OrderItem>();
		OrderItem detail1 = new OrderItem();
		detail1.setNo(1022L);
		detail1.setCount(1);
		detail1.setType(1);
		detail1.setArea("云南省");
		detail1.setName("事业单位招聘过关练习题库");
		detail1.setPrice(20);
		detail1.setStatus(0);
		
		OrderItem detail2 = new OrderItem();
		detail2.setNo(1023L);
		detail1.setCount(1);
		detail1.setType(1);
		detail2.setArea("上海市");
		detail2.setName("上海市事业单位招聘考试");
		detail2.setPrice(120);
		detail2.setStatus(0);
		
		OrderItem detail3 = new OrderItem();
		detail3.setNo(1024L);
		detail1.setCount(1);
		detail1.setType(2);
		detail3.setArea("南昌市");
		detail3.setName("银行从业资格公共基础");
		detail3.setPrice(40);
		detail3.setStatus(1);
		goodses.add(detail1);
		goodses.add(detail2);
		goodses.add(detail3);
		
		return goodses;
	}
	
	public static List<CostRecord> getCostRecords(){
		List<CostRecord> costRecords = new ArrayList<CostRecord>();
		CostRecord records1 = new CostRecord();
		records1.setOperateType(1);
		records1.setAmount(20);
		records1.setBalance(20);
		records1.setTime(new Date());
		records1.setMemo("管理员(122730)操作");
		
		CostRecord records2 = new CostRecord();
		records2.setOperateType(1);
		records2.setAmount(-15);
		records2.setBalance(5);
		records2.setTime(new Date());
		records2.setMemo("6074");
		
		CostRecord records3 = new CostRecord();
		records3.setOperateType(1);
		records3.setAmount(15);
		records3.setBalance(20);
		records3.setTime(new Date());
		records3.setMemo("管理员(122730)操作");
		
		CostRecord records4 = new CostRecord();
		records4.setOperateType(1);
		records4.setRechangeType(1);
		records4.setAmount(-20);
		records4.setBalance(0);
		records4.setTime(new Date());
		records4.setMemo("6044");
		
		costRecords.add(records1);
		costRecords.add(records2);
		costRecords.add(records3);
		costRecords.add(records4);
		costRecords.add(records1);
		costRecords.add(records2);
		costRecords.add(records3);
		costRecords.add(records4);
		costRecords.add(records1);
		costRecords.add(records2);
		costRecords.add(records3);
		costRecords.add(records4);
		return costRecords;
	}

}
